<template>
    <div class="app-container">
 
    </div>
  </template>
  
  <script>
  import { getJob} from "@/api/monitor/job";
  import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
  
  export default {
    name: "JobLog",
    dicts: ['sys_common_status', 'sys_job_group'],
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 调度日志表格数据
        jobLogList: [],
        // 是否显示弹出层
        open: false,
        // 日期范围
        dateRange: [],
        // 表单参数
        form: {},
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          jobName: undefined,
          jobGroup: undefined,
          status: undefined
        }
      };
    },
    created() {
      this.loading=true
      this.$message.error('暂无页面')
      // const jobId = this.$route.params && this.$route.params.jobId;
      // if (jobId !== undefined && jobId != 0) {
      //   getJob(jobId).then(response => {
      //     this.queryParams.jobName = response.data.jobName;
      //     this.queryParams.jobGroup = response.data.jobGroup;
      //     this.getList();
      //   });
      // } else {
      //   this.getList();
      // }
    },
    methods: {
      /** 查询调度日志列表 */
      getList() {
        this.loading = true;
        listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
            this.jobLogList = response.rows;
            this.total = response.total;
            this.loading = false;
          }
        );
      },
      // 返回按钮
      handleClose() {
        const obj = { path: "/monitor/job" };
        this.$tab.closeOpenPage(obj);
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.dateRange = [];
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.jobLogId);
        this.multiple = !selection.length;
      },
      /** 详细按钮操作 */
      handleView(row) {
        this.open = true;
        this.form = row;
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const jobLogIds = this.ids;
        this.$modal.confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项？').then(function() {
          return delJobLog(jobLogIds);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      },
      /** 清空按钮操作 */
      handleClean() {
        this.$modal.confirm('是否确认清空所有调度日志数据项？').then(function() {
          return cleanJobLog();
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("清空成功");
        }).catch(() => {});
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('/monitor/jobLog/export', {
          ...this.queryParams
        }, `log_${new Date().getTime()}.xlsx`)
      }
    }
  };
  </script>
  